<%-- 
    Document   : navbar
    Created on : 12/Dez/2014, 22:56:19
    Author     : a21210380 a21210392
    Trabalho PD - 2014/2015
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<div id="mynavbar">
    <div class="navbar" role="navigation">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#mynavbar-content">
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            
            <a class="navbar-brand" href="/Trabalho_PD/homepage.html"><i class="fa fa-home fa-2x"></i></span> Catch My Ride</a>
            
        </div>

        <c:if test="${waiting != null}">
            <div class="collapse navbar-collapse" id="mynavbar-content">
                <ul class="nav navbar-nav navbar-right">
                    <li class="active">
                        <div class="well well-sm">
                            <form class="form-inline">
                                <div class="form-group has-error has-feedback">
                                    <label class="form-control btn-warning">The administration didn't accept your account yet!</label>
                                </div>
                                <button onclick="onClickLogOut()" type="button" class="btn btn-primary" title="Logout">
                                    <i class="fa fa-power-off fa-2x"></i>
                                </button>
                            </form>
                        </div>
                    </li> 
                </ul>
            </div>
        </c:if>
        <c:if test="${cancelled != null}">
            <div class="collapse navbar-collapse" id="mynavbar-content">
                <ul class="nav navbar-nav navbar-right">
                    <li class="active">
                        <div class="well well-sm">
                            <form class="form-inline">
                                <c:if test="${!cancelled.isUnlocked()}">
                                    <button onclick="onClickUnlockAccount()" type="button" class="btn btn-primary" title="Unlock account">
                                        <i class="fa fa-unlock fa-2x"></i>
                                    </button>
                                </c:if>
                                <c:if test="${cancelled.isUnlocked()}">
                                    <div class="form-group has-error has-feedback">
                                        <label class="form-control btn-warning">The administration didn't accept your account yet!</label>
                                    </div>
                                </c:if>
                                <button onclick="onClickLogOut()" type="button" class="btn btn-primary" title="Logout">
                                    <i class="fa fa-power-off fa-2x"></i>
                                </button>
                            </form>
                        </div>
                    </li> 
                </ul>
            </div>
        </c:if> 
        <c:if test="${cancelled == null && waiting == null}">
            <c:if test="${user != null}">
                <div class="collapse navbar-collapse" id="mynavbar-content">
                    Bem vindo ${user.getName()}!
                    <ul class="nav navbar-nav navbar-right">
                        <li class="active">
                            <button type="button" onclick="onClickMyTrips()" class="btn btn-primary" title="My trips">
                                <i class="fa fa-plane  fa-2x"></i>
                            </button>
                        </li>
                        <li class="active">
                            <button type="button" onclick="onClickForum()" class="btn btn-primary" title="Forum">
                                <i class="fa fa-comments fa-2x"></i>
                            </button>
                        </li>
                        <li>
                            <button type="button" onclick="onClickEmail()" class="btn btn-primary" title="E-mail">
                                <i class="fa fa-envelope-o fa-2x"></i>
                            </button>
                        </li>
                        <li>
                            <button type="button" onclick="onClickCars()" class="btn btn-primary" title="Cars">
                                <i class="fa fa-car fa-2x"></i>
                            </button>
                        </li>
                        <li class="active">
                            <button type="button" onclick="onClickUserAccountConfiguration()" class="btn btn-primary" title="Account Settings">
                                <i class="fa fa-user fa-2x"></i>
                            </button>
                        </li>
                        <li>
                            <button type="button" onclick="onClickLogOut()" class="btn btn-primary" title="Logout">
                                <i class="fa fa-power-off fa-2x"></i>
                            </button>
                        </li>
                    </ul>
                </div>
            </c:if>
            <c:if test="${admin != null}">
                <div class="collapse navbar-collapse" id="mynavbar-content">
                    Bem vindo ${admin.getName()}!

                    <ul class="nav navbar-nav navbar-right">
                        <!--<li class="active">
                            <button type="button" class="btn btn-primary" title="Reports">
                                <i class="fa fa-flag fa-2x"></i>
                            </button>
                        </li>-->
                        <li>
                            <button type="button" onclick="onClickAccounts()" class="btn btn-primary" title="Accounts">
                                <i class="fa fa-users fa-2x"></i>
                            </button>
                        </li>
                        <li>
                            <button type="button" onclick="onClickForum()" class="btn btn-primary" title="Forum">
                                <i class="fa fa-comments fa-2x"></i>
                            </button>
                        </li>
                        <li>
                            <button type="button" onclick="onClickServerConfiguration()" class="btn btn-primary" title="Server configurations">
                                <i class="fa fa-cog fa-2x"></i>
                            </button>
                        </li>
                        <li class="active">
                            <button type="button" onclick="onClickAdminAccountConfiguration()" class="btn btn-primary" title="Account Settings">
                                <i class="fa fa-user fa-2x"></i>
                            </button>
                        </li>
                        <li>
                            <button onclick="onClickLogOut()" type="button" class="btn btn-primary" title="Logout">
                                <i class="fa fa-power-off fa-2x"></i>
                            </button>
                        </li>
                    </ul>
                </div>
            </c:if>

            <c:if test="${admin == null && user == null}">
                <div class="collapse navbar-collapse" id="mynavbar-content">
                    <ul class="nav navbar-nav navbar-right">
                        <li class="active">
                            <div class="well well-sm">
                                <form class="form-inline">
                                    <div class="form-group">
                                        <input type="text" class="form-control" id="usernameField" placeholder="Enter username">
                                    </div>
                                    <div class="form-group">
                                        <input type="password" class="form-control" id="passwordField" placeholder="Password">
                                    </div>
                                    <!--<div class="checkbox">
                                        <label>
                                            <input type="checkbox"> Remember me
                                        </label>
                                    </div>-->
                                    <button type="button" onclick="onClickLogin()" class="btn btn-primary">Sign in</button>
                                    <a class="btn btn-primary" href="/Trabalho_PD/register.html">Register</a>
                                </form>
                            </div>
                        </li> 
                    </ul>
                </div>
            </c:if>
        </c:if>
    </div>
</div>